<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: 86177
  Date: 2021/11/17
  Time: 19:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>列表展示</title>
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.8.3.min.js"></script>
    <link href="${pageContext.request.contextPath}/static/css/index3.css" rel="stylesheet">
</head>
<body>
<form enctype="multipart/form-data" method="post" action="list">
    <input type="hidden" name="pageNum">
    <select name="colum">
        <option value="">---情选择---</option>
        <option value="borrow" ${vo.colum == 'borrow' ? 'selected' : ''}>借方</option>
        <option value="loan" ${vo.colum == 'loan' ? 'selected' : ''}>贷方</option>
        <option value="money" ${vo.colum == 'money' ? 'selected' : ''}>余额</option>
    </select>
    <input type="text" name="minText" value="${vo.minText}"> 至 <input type="text" name="maxText" value="${vo.maxText}">
    <select name="col">
        <option value="">---情选择---</option>
        <option value="account_id" ${vo.col == 'account_id' ? 'selected' : ''}>源账号</option>
        <option value="account_name" ${vo.col == 'account_name' ? 'selected' : ''}>源账号名称</option>
        <option value="toid" ${vo.col == 'toid' ? 'selected' : ''}>目标账号</option>
        <option value="toname" ${vo.col == 'toname' ? 'selected' : ''}>目标账号名称</option>
        <option value="aim_id" ${vo.col == 'aim_id' ? 'selected' : ''}>科目编号</option>
        <option value="aim_name" ${vo.col == 'aim_name' ? 'selected' : ''}>科目</option>
    </select>
    <input type="text" name="contest" value="${vo.contest}">
    摘要:<input type="text" name="context" value="${vo.context}">
    财务日期:<input type="date" name="minDate" value='<fmt:formatDate value="${vp.minDate}" pattern="yyyy-MM-dd"></fmt:formatDate>'>
    至<input type="date" name="maxDate" value='<fmt:formatDate value="${vp.maxDate}" pattern="yyyy-MM-dd"></fmt:formatDate>'>
    <input type="submit" value="搜索">
</form>
<table>
    <tr>
        <td>编号</td>
        <td>财务日期</td>
        <td>源账号</td>
        <td>源账号名称</td>
        <td>目标账号</td>
        <td>目标账号名称</td>
        <td>科目编号</td>
        <td>科目</td>
        <td>摘要</td>
        <td>借方</td>
        <td>贷方</td>
        <td>余额</td>
    </tr>
    <c:forEach items="${p.list}" var="l">
        <tr>
            <td>${l.id}</td>
            <td>
                <fmt:formatDate value="${l.finDate}" pattern="yyyy-MM-dd"></fmt:formatDate>
            </td>
            <td>${l.fromId}</td>
            <td>${l.fromname}</td>
            <td>${l.toid}</td>
            <td>${l.toname}</td>
            <td>${l.aimId}</td>
            <td>${l.aimName}</td>
            <td>${l.context}</td>
            <td>${l.borrow}</td>
            <td>${l.loan}</td>
            <td>${l.money}</td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="100">
            <input type="button" value="添加" onclick="toadd()">
            <input type="button" value="首页" onclick="page(1)">
            <input type="button" value="上一页" onclick="page(${p.pageNum == 1 ? 1 : p.pageNum-1})">
            <input type="button" value="下一页" onclick="page(${p.pageNum == p.pages ? p.pages : p.pageNum + 1})">
            <input type="button" value="尾页" onclick="page(${p.pages})">
        </td>
    </tr>
</table>
<script>
    function page(pageNum){
        $("[name='pageNum']").val(pageNum);
        $("form").submit();
    }
    function toadd(){
        location.href= "toadd";
    }
</script>
</body>
</html>
